#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
	int x[44],y[44];
	x[1] = 1;
	y[1] = 1;
	for(int i = 2;i<=40;i++)
	{
		x[i] = y[i-1];
		y[i] = x[i-1]+y[i-1];
	}
	int n;
	while(scanf("%d",&n)&&n!=0)
	{
		printf("%d\n",x[n]+y[n]);
	}
} 
